import re
def validation(text, id, dict_excel):
    if text == None:
        return False
    try:
        text = float(text)
    except:
        return False
    match id:
        case 'cil':
            if text == int(dict_excel['cil']): return True
            return False
        case 'RCIL':
            if text >= 0 and text < 180: return True
            return False
        case 'iwar':
            if text == 1 or text == 2: return True
            return False
        case 'dz':
            if text < float(dict_excel['dl12']): return True
            return False
        case 'l':
            if text > float(dict_excel['r']): return True
            return False
        case 'r':
            if text < float(dict_excel['l']): return True
            return False
        case 'bkan1':
            if text < float(dict_excel['bkor1']): return True
            return False
        case 'bkan2':
            if text < float(dict_excel['bkor2']): return True
            return False
        case 'bkan3':
            if text < float(dict_excel['bkor3']): return True
            return False
        case 'bkan4':
            if text < float(dict_excel['bkor4']): return True
            return False
        case 'bkan5':
            if text < float(dict_excel['bkor5']): return True
            return False
        case 'bkan6':
            if text < float(dict_excel['bkor6']): return True
            return False
        case 'bkan7':
            if text < float(dict_excel['bkor7']): return True
            return False
        case 'lw':
            if text == 1 or text == 2:
                return True
            return False
        case 'nw':
            if text == 0 or text == 1 or text == 2 or text == 3:
                return True
            return False
        case _:
            return True
def valid_item(string):
    if len(string):
        if re.fullmatch(r'([A-Za-z]+)', string) != None or re.fullmatch('([а-яёА-ЯЁ]+)', string) != None:
            return True
    return False
def valid_fullname(name, lastname, patronymic):
    return all([valid_item(name), valid_item(lastname), valid_item(patronymic)])

def valid_filename(string):
    if string.count('.') or string == "":
        return False
    return True